﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DAO;
using DTO;

namespace QuanLyCuaHangVideo
{
    public partial class frmThemKH : Form
    {
        public frmThemKH()
        {
            InitializeComponent();
        }

        private void btnDong_Click(object sender, EventArgs e)
        {
            Close();
        }

        //button thêm khách hàng
        private void btnThemKH_Click(object sender, EventArgs e)
        {
            KhachHang kh = new KhachHang();
            kh.HoTen = txtHoTenKH.Text.Trim();
            kh.CMND = txtCMNDKH.Text.Trim();
            kh.DiaChi = txtDiaChiKH.Text.Trim();
            kh.DienThoai = txtDienThoaiKH.Text.Trim();
            bool kq = KhachHangDAO.ThemKH(kh);
            if (kq)
            {
                MessageBox.Show("Thêm khách hàng thành công!");
                txtHoTenKH.Text = "";
                txtCMNDKH.Text = "";
                txtDiaChiKH.Text = "";
                txtDienThoaiKH.Text = "";
            }
            else
            {
                MessageBox.Show("Thêm thất bại!");
            }
        }
    }
}
